/*

This file runs the wild bootstrap that produces p-values for specifications with partner
	performance interactions.



*/



clear
set more off
clear all

*set paths
cd
global figurepath  
global datapath  
global tablepath  
global logpath
 
use "$datapath\DataforAnalysis.dta", clear
 
 
capture log close
log using "$logpath/T5_Wild", replace

 gen hp_post = highperformerpartner*(Week>4)
gen WK_Plus = Week+10 // Make sure weeks are positive because boottest cannot concentrate out 2 dimensions of fixed effects.

*------------------------------------------------------------------------------*
*                    TABLE Samples 
*------------------------------------------------------------------------------*

	
*High and non high performer samples and subsamples
	local highsample1 `baselinesample1'
	local highsample2 "if Week > -4 & Week < 5 & Treatment !=5 & highperformer == 0"
	local highsample3 "if Week > -4 & Week < 5 & Treatment !=5 & highperformer == 1"
	local highsample4 `persistencesample1'
	local highsample5 "if (Week >= -3 & Week <= 0  & Treatment !=5 & highperformer == 0) | (Week >= 5 & Week <= 24  & Treatment !=5 & highperformer == 0) "
	local highsample6 "if (Week >= -3 & Week <= 0 & Treatment !=5 & highperformer == 1 ) | (Week >= 5 & Week <= 24 & Treatment !=5 & highperformer == 1 ) "

 
** Table with RPC as the DV.
 areg RPC   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample1' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high
areg RPC   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample2' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high
areg RPC   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample3' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg RPC  i.WK_Plus    pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner hp_post    `highsample4' , absorb(manager) cluster(manager) robust
boottest pairincentive_post_high structuredmeeting_post_high combined_post_high



areg RPC  i.WK_Plus pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner  hp_post   `highsample5' , absorb(manager) cluster(manager) robust
boottest pairincentive_post_high structuredmeeting_post_high combined_post_high

areg RPC  i.WK_Plus pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner hp_post    `highsample6' , absorb(manager) cluster(manager) robust
boottest pairincentive_post_high structuredmeeting_post_high combined_post_high
 

**Table with lrpc as the DV
areg lrpc   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample1' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg lrpc   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample2' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg lrpc   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample3' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg lrpc  i.WK_Plus    pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner hp_post    `highsample4' , absorb(manager) cluster(manager) robust
 boottest  pairincentive_post_high structuredmeeting_post_high combined_post_high

areg lrpc  pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner  hp_post   `highsample5' , absorb(manager) cluster(manager) robust
boottest pairincentive_post_high structuredmeeting_post_high combined_post_high

areg lrpc   pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner hp_post    `highsample6' , absorb(manager) cluster(manager) robust
boottest  pairincentive_post_high structuredmeeting_post_high combined_post_high
 
**Table with Total Calls as the DV
areg calls   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample1' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg calls   i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample2' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg calls  i.WK_Plus  pairincentive structuredmeeting combined pairincentive_high structuredmeeting_high combined_high highperformerpartner highperformerpartner_ever  `highsample3' , absorb(manager) cluster(manager) robust
boottest pairincentive_high structuredmeeting_high combined_high

areg calls  i.WK_Plus    pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner hp_post    `highsample4' , absorb(manager) cluster(manager) robust
boottest  pairincentive_post_high structuredmeeting_post_high combined_post_high

areg calls pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner  hp_post   `highsample5' , absorb(manager) cluster(manager) robust
boottest pairincentive_post_high structuredmeeting_post_high combined_post_high

areg calls   pairincentivepost structuredmeetingpost combinedpost pairincentive_post_high structuredmeeting_post_high combined_post_high highperformerpartner hp_post    `highsample6' , absorb(manager) cluster(manager) robust
boottest  pairincentive_post_high structuredmeeting_post_high combined_post_high
 


log close
